<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>
    <link rel="stylesheet" href="../../css/weui.css">
		<link rel="stylesheet" href="../../css/jQuery_WeUI.css">

    <style type="text/css">
        #tx {
            border-radius: 50%;
            width: 30px;
            height: 30px;
            display: inline;
            position: absolute;
            top: 7px;
            left: 3px;
        }

        .member_info {
            float: left;
            width: 25%;
            background-color: #FFFFFF;
        }

        .group_member {
            /*border-bottom:1px solid #EFEFEF;*/
            /*margin:0px 15px*/
            background-color: #FFFFFF;

        }

        .member_info div {
            margin: 10px 15px
        }

        .meber_nickname {
            color: #000000;
            padding: 2px;
            text-align: center;
            font-size: 14px
        }
        *{
          -webkit-box-sizing: inherit;
                  box-sizing: inherit;
        }
        .group_top_info{
          -webkit-box-sizing: border-box;
                  box-sizing: border-box;
        }
        .weui-swiped-btn{
          height: 76px;
          line-height:   60px;
        }
    </style>
</head>
<body>
  <div id="blank" class="header">
      <div v-back.tapmode class="back"></div>
      <span class="title">群长老列表</span>
  </div>
<div id="app" v-cloak>
    <div class="group_top_info" style="margin-top:10px">
      <div class="aui-content aui-margin-b-15">
        <div class="aui-searchbar" id="search">
          <div class="aui-searchbar-input aui-border-radius">
            <i class="aui-iconfont aui-icon-search"></i>
            <input type="number" placeholder="请输入会员昵称" id="nickname">
          </div>
        </div>
        <div class="weui-cells">
          <div class="aui-list-item aui-list-item-middle weui-cell" style="padding:0px" v-bind:class="[{'weui-cell_swiped':role>2&&content.member_id!=getPrefs('member_id')},'item'+content.member_id]" v-for="(content, index) in members.managers">
            <div class="weui-cell__bd">
              <div class="weui-cell">
                <div class="weui-cell__hd"><img style="width:56px;height:56px;border-radius:8px" v-image-resize="{src:content.portrait?content.portrait:'../res/tx00.jpg'}" alt="" ></div>
                <div class="weui-cell__bd" style="margin-left:10px">
                  <p style="color:#333;font-size:18px">{{content.member_nickname?content.member_nickname:content.nickname}}</p>
                  <p style="color:#333;font-size:12px">{{content.cow}}头奶牛</p>

                </div>
                <!-- <div class="weui-cell__ft">向左滑动试试</div> -->
              </div>
            </div>
            <div class="weui-cell__ft" v-show="role>2&&content.member_id!=getPrefs('member_id')">
              <a class="weui-swiped-btn weui-swiped-btn_warn close-swipeout" v-myclick="[content.member_id,cancelmanager]">撤销长老</a>
            </div>
          </div>
        </div>
          </div>
    </div>
</div>
</body>
<script src="../../script/api.js"></script>

<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script src="../../script/jQuery_WeUI.js"></script>
<script type="text/javascript">
    var members;
    apiready = function () {
        api.parseTapmode();
        showProgress();
        console.log(api.pageParam.role);
        setBSImg();
        new Vue({
  					el: '#blank'
  			});
        var data = {
            member_id: getPrefs('member_id'),
            clan_id: api.pageParam.group_id,
            sort: 1,
        };
        var callback = function (ret) {
            members = ret.content;
            initApp();
            api.parseTapmode();
        };
        pinet.post(URL.getClanMembers, data, callback);
    };

		function initApp() {
        vm = new Vue({
            el: '#app',
            data: {
                members:members,
                role:api.pageParam.role
            },
            computed: {
            },
            methods: {
              member_info:function(member_id){
                openWin('member_info',{uid:member_id,group_id:api.pageParam.group_id})
              },
              cancelmanager:function(member_id){
                api.confirm({
                    title: '提示',
                    msg: '确认撤销长老？',
                    buttons: ['确定', '取消']
                }, function(ret, err){
                    if( ret.buttonIndex == 1 ){
                      var data = {
                          member_id: getPrefs('member_id'),
                          clan_id: api.pageParam.group_id,
                          another_id: member_id,
                          role:0
                      };
                      var callback = function (ret) {
                        api.sendEvent({
                            name: 'updateClan',
                        });
                        $api.remove($api.dom('.item'+member_id));

                      };
                      pinet.post(URL.setClanManager, data, callback);
                    }else{

                    }
                });

              }
            },
            mounted:function(){
              if(api.pageParam.role>=2){
                $(".weui-cell_swiped").swipeout();

              }
        },

        });
    }
</script>
</html>
